<?php 
if (!isset($_POST['checked'])) {
	exit();
}

require_once ('../conf/pdoConnect.php');
require_once ('./check.php');

$mailId = $_POST['checked'];
$uid = $_SESSION['uid'];

foreach ($mailId as $v) {
	$v = intval($v);
	delMail($db, $v, $uid);
}

function delMail($db, $id, $uid)
{
	$sql = "delete from sendMail where `id` = $id and `belongId` = $uid";
	$query = $db->query($sql);
}

header("Location: ./getMailList.php");

$db = null;